Double

class Double : Number, Comparable<Double>

Represents a double-precision 64-bit IEEE 754 floating point number. On the JVM, non-nullable values of this type are represented as values of the primitive type double.

Types

Companion
Link copied to clipboard
object Companion

Functions

compareTo
Link copied to clipboard
operator fun compareTo(other: Byte): Int
open operator override fun compareTo(other: Double): Int
operator fun compareTo(other: Float): Int
operator fun compareTo(other: Int): Int
operator fun compareTo(other: Long): Int
operator fun compareTo(other: Short): Int

Compares this value with the specified value for order. Returns zero if this value is equal to the specified other value, a negative number if it's less than other, or a positive number if it's greater than other.

dec
Link copied to clipboard
operator fun dec(): Double

Decrements this value.

div
Link copied to clipboard
operator fun div(other: Byte): Double
operator fun div(other: Double): Double
operator fun div(other: Float): Double
operator fun div(other: Int): Double
operator fun div(other: Long): Double
operator fun div(other: Short): Double

Divides this value by the other value.

inc
Link copied to clipboard
operator fun inc(): Double

Increments this value.

minus
Link copied to clipboard
operator fun minus(other: Byte): Double
operator fun minus(other: Double): Double
operator fun minus(other: Float): Double
operator fun minus(other: Int): Double
operator fun minus(other: Long): Double
operator fun minus(other: Short): Double

Subtracts the other value from this value.

plus
Link copied to clipboard
operator fun plus(other: Byte): Double
operator fun plus(other: Double): Double
operator fun plus(other: Float): Double
operator fun plus(other: Int): Double
operator fun plus(other: Long): Double
operator fun plus(other: Short): Double

Adds the other value to this value.

rem
Link copied to clipboard
operator fun rem(other: Byte): Double
operator fun rem(other: Double): Double
operator fun rem(other: Float): Double
operator fun rem(other: Int): Double
operator fun rem(other: Long): Double
operator fun rem(other: Short): Double

Calculates the remainder of truncating division of this value by the other value.

Since Kotlin

1.1
times
Link copied to clipboard
operator fun times(other: Byte): Double
operator fun times(other: Double): Double
operator fun times(other: Float): Double
operator fun times(other: Int): Double
operator fun times(other: Long): Double
operator fun times(other: Short): Double

Multiplies this value by the other value.

toByte
Link copied to clipboard
@DeprecatedSinceKotlin(warningSince = "1.3", errorSince = "1.5")
open override fun toByte(): Byte

Converts this Double value to Byte.

toChar
Link copied to clipboard
@DeprecatedSinceKotlin(warningSince = "1.5")
open override fun toChar(): Char

Converts this Double value to Char.

toDouble
Link copied to clipboard
open override fun toDouble(): Double

Returns this value.

toFloat
Link copied to clipboard
open override fun toFloat(): Float

Converts this Double value to Float.

toInt
Link copied to clipboard
open override fun toInt(): Int

Converts this Double value to Int.

toLong
Link copied to clipboard
open override fun toLong(): Long

Converts this Double value to Long.

toShort
Link copied to clipboard
@DeprecatedSinceKotlin(warningSince = "1.3", errorSince = "1.5")
open override fun toShort(): Short

Converts this Double value to Short.

unaryMinus
Link copied to clipboard
operator fun unaryMinus(): Double

Returns the negative of this value.

unaryPlus
Link copied to clipboard
operator fun unaryPlus(): Double

Returns this value.

Extensions

absoluteValue
Link copied to clipboard
expect val Double.absoluteValue: Double

Returns the absolute value of this value.

actual val Double.absoluteValue: Double

Returns the absolute value of this value.

actual val Double.absoluteValue: Double

Returns the absolute value of this value.

actual val Double.absoluteValue: Double

Returns the absolute value of this value.

coerceAtLeast
Link copied to clipboard
fun Double.coerceAtLeast(minimumValue: Double): Double

Ensures that this value is not less than the specified minimumValue.

coerceAtMost
Link copied to clipboard
fun Double.coerceAtMost(maximumValue: Double): Double

Ensures that this value is not greater than the specified maximumValue.

coerceIn
Link copied to clipboard
fun Double.coerceIn(minimumValue: Double, maximumValue: Double): Double

Ensures that this value lies in the specified range minimumValue..maximumValue.

days
Link copied to clipboard
val Double.days: Duration

Returns a Duration equal to this Double number of days.

hours
Link copied to clipboard
val Double.hours: Duration

Returns a Duration equal to this Double number of hours.

IEEErem
Link copied to clipboard
inline fun Double.IEEErem(divisor: Double): Double

Computes the remainder of division of this value by the divisor value according to the IEEE 754 standard.

external fun Double.IEEErem(divisor: Double): Double

Computes the remainder of division of this value by the divisor value according to the IEEE 754 standard.

isFinite
Link copied to clipboard
expect fun Double.isFinite(): Boolean
actual inline fun Double.isFinite(): Boolean

Returns true if the argument is a finite floating-point value; returns false otherwise (for NaN and infinity arguments).

actual fun Double.isFinite(): Boolean

Returns true if the argument is a finite floating-point value; returns false otherwise (for NaN and infinity arguments).

actual external fun Double.isFinite(): Boolean

Returns true if the argument is a finite floating-point value; returns false otherwise (for NaN and infinity arguments).

isInfinite
Link copied to clipboard
expect fun Double.isInfinite(): Boolean
actual inline fun Double.isInfinite(): Boolean

Returns true if this value is infinitely large in magnitude.

actual fun Double.isInfinite(): Boolean

Returns true if this value is infinitely large in magnitude.

actual external fun Double.isInfinite(): Boolean

Returns true if this value is infinitely large in magnitude.

isNaN
Link copied to clipboard
expect fun Double.isNaN(): Boolean
actual inline fun Double.isNaN(): Boolean

Returns true if the specified number is a Not-a-Number (NaN) value, false otherwise.

actual fun Double.isNaN(): Boolean

Returns true if the specified number is a Not-a-Number (NaN) value, false otherwise.

actual external fun Double.isNaN(): Boolean

Returns true if the specified number is a Not-a-Number (NaN) value, false otherwise.

microseconds
Link copied to clipboard
val Double.microseconds: Duration

Returns a Duration equal to this Double number of microseconds.

milliseconds
Link copied to clipboard
val Double.milliseconds: Duration

Returns a Duration equal to this Double number of milliseconds.

minutes
Link copied to clipboard
val Double.minutes: Duration

Returns a Duration equal to this Double number of minutes.

mod
Link copied to clipboard
inline fun Double.mod(other: Float): Double
inline fun Double.mod(other: Double): Double

Calculates the remainder of flooring division of this value by the other value.

nanoseconds
Link copied to clipboard
val Double.nanoseconds: Duration

Returns a Duration equal to this Double number of nanoseconds.

nextDown
Link copied to clipboard
expect fun Double.nextDown(): Double

Returns the Double value nearest to this value in direction of negative infinity.

actual inline fun Double.nextDown(): Double

Returns the Double value nearest to this value in direction of negative infinity.

actual fun Double.nextDown(): Double

Returns the Double value nearest to this value in direction of negative infinity.

actual external fun Double.nextDown(): Double

Returns the Double value nearest to this value in direction of negative infinity.

nextTowards
Link copied to clipboard
expect fun Double.nextTowards(to: Double): Double

Returns the Double value nearest to this value in direction from this value towards the value to.

actual inline fun Double.nextTowards(to: Double): Double

Returns the Double value nearest to this value in direction from this value towards the value to.

actual fun Double.nextTowards(to: Double): Double

Returns the Double value nearest to this value in direction from this value towards the value to.

actual external fun Double.nextTowards(to: Double): Double

Returns the Double value nearest to this value in direction from this value towards the value to.

nextUp
Link copied to clipboard
expect fun Double.nextUp(): Double

Returns the Double value nearest to this value in direction of positive infinity.

actual inline fun Double.nextUp(): Double

Returns the Double value nearest to this value in direction of positive infinity.

actual fun Double.nextUp(): Double

Returns the Double value nearest to this value in direction of positive infinity.

actual external fun Double.nextUp(): Double

Returns the Double value nearest to this value in direction of positive infinity.

pow
Link copied to clipboard
expect fun Double.pow(x: Double): Double

Raises this value to the power x.

expect fun Double.pow(n: Int): Double

Raises this value to the integer power n.

actual inline fun Double.pow(x: Double): Double

Raises this value to the power x.

actual inline fun Double.pow(n: Int): Double

Raises this value to the integer power n.

actual inline fun Double.pow(x: Double): Double

Raises this value to the power x.

actual inline fun Double.pow(n: Int): Double

Raises this value to the integer power n.

actual external fun Double.pow(x: Double): Double

Raises this value to the power x.

actual fun Double.pow(n: Int): Double

Raises this value to the integer power n.

rangeTo
Link copied to clipboard
operator fun Double.rangeTo(that: Double): ClosedFloatingPointRange<Double>

Creates a range from this Double value to the specified that value.

roundToInt
Link copied to clipboard
expect fun Double.roundToInt(): Int

Rounds this Double value to the nearest integer and converts the result to Int. Ties are rounded towards positive infinity.

actual fun Double.roundToInt(): Int

Rounds this Double value to the nearest integer and converts the result to Int. Ties are rounded towards positive infinity.

actual fun Double.roundToInt(): Int

Rounds this Double value to the nearest integer and converts the result to Int. Ties are rounded towards positive infinity.

actual fun Double.roundToInt(): Int

Rounds this Double value to the nearest integer and converts the result to Int. Ties are rounded towards positive infinity.

roundToLong
Link copied to clipboard
expect fun Double.roundToLong(): Long

Rounds this Double value to the nearest integer and converts the result to Long. Ties are rounded towards positive infinity.

actual fun Double.roundToLong(): Long

Rounds this Double value to the nearest integer and converts the result to Long. Ties are rounded towards positive infinity.

actual fun Double.roundToLong(): Long

Rounds this Double value to the nearest integer and converts the result to Long. Ties are rounded towards positive infinity.

actual fun Double.roundToLong(): Long

Rounds this Double value to the nearest integer and converts the result to Long. Ties are rounded towards positive infinity.

seconds
Link copied to clipboard
val Double.seconds: Duration

Returns a Duration equal to this Double number of seconds.

sign
Link copied to clipboard
expect val Double.sign: Double

Returns the sign of this value:

actual val Double.sign: Double

Returns the sign of this value:

actual val Double.sign: Double

Returns the sign of this value:

actual val Double.sign: Double

Returns the sign of this value:

times
Link copied to clipboard
inline operator fun Double.times(duration: Duration): Duration

Returns a duration whose value is the specified duration value multiplied by this number.

toBigDecimal
Link copied to clipboard
inline fun Double.toBigDecimal(): BigDecimal
inline fun Double.toBigDecimal(mathContext: MathContext): BigDecimal

Returns the value of this Double number as a BigDecimal.

toBits
Link copied to clipboard
expect fun Double.toBits(): Long

Returns a bit representation of the specified floating-point value as Long according to the IEEE 754 floating-point "double format" bit layout.

actual inline fun Double.toBits(): Long

Returns a bit representation of the specified floating-point value as Long according to the IEEE 754 floating-point "double format" bit layout.

actual fun Double.toBits(): Long

Returns a bit representation of the specified floating-point value as Long according to the IEEE 754 floating-point "double format" bit layout.

actual inline fun Double.toBits(): Long

Returns a bit representation of the specified floating-point value as Long according to the IEEE 754 floating-point "double format" bit layout.

toDuration
Link copied to clipboard
fun Double.toDuration(unit: DurationUnit): Duration

Returns a Duration equal to this Double number of the specified unit.

toRawBits
Link copied to clipboard
expect fun Double.toRawBits(): Long

Returns a bit representation of the specified floating-point value as Long according to the IEEE 754 floating-point "double format" bit layout, preserving NaN values exact layout.

actual inline fun Double.toRawBits(): Long

Returns a bit representation of the specified floating-point value as Long according to the IEEE 754 floating-point "double format" bit layout, preserving NaN values exact layout.

actual fun Double.toRawBits(): Long

Returns a bit representation of the specified floating-point value as Long according to the IEEE 754 floating-point "double format" bit layout, preserving NaN values exact layout.

actual inline fun Double.toRawBits(): Long

Returns a bit representation of the specified floating-point value as Long according to the IEEE 754 floating-point "double format" bit layout, preserving NaN values exact layout.

toUInt
Link copied to clipboard
inline fun Double.toUInt(): UInt

Converts this Double value to UInt.

toULong
Link copied to clipboard
inline fun Double.toULong(): ULong

Converts this Double value to ULong.

ulp
Link copied to clipboard
expect val Double.ulp: Double

Returns the ulp (unit in the last place) of this value.

actual val Double.ulp: Double

Returns the ulp (unit in the last place) of this value.

actual val Double.ulp: Double

Returns the ulp (unit in the last place) of this value.

actual val Double.ulp: Double

Returns the ulp (unit in the last place) of this value.

withSign
Link copied to clipboard
expect fun Double.withSign(sign: Double): Double
expect fun Double.withSign(sign: Int): Double

Returns this value with the sign bit same as of the sign value.

actual inline fun Double.withSign(sign: Double): Double
actual inline fun Double.withSign(sign: Int): Double

Returns this value with the sign bit same as of the sign value.

actual fun Double.withSign(sign: Double): Double
actual inline fun Double.withSign(sign: Int): Double

Returns this value with the sign bit same as of the sign value.

actual external fun Double.withSign(sign: Double): Double
actual fun Double.withSign(sign: Int): Double

Returns this value with the sign bit same as of the sign value.